using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using Prisa.DataAccess.Mapping;
using Prisa.Entities;

namespace Prisa.DataAccess
{
    public partial class PRISAContext : DbContext
    {
        static PRISAContext()
        {
            Database.SetInitializer<PRISAContext>
                (
                                  //new DropCreateDatabaseAlways <PRISAContext>()
                                  //new PrisaDatabaseInitializer()
                                 null
                );
        }

        public PRISAContext()
            : base("Name=PRISAContext")
        {
            this.Configuration.LazyLoadingEnabled = false;
            this.Configuration.ProxyCreationEnabled = false;
            this.Configuration.AutoDetectChangesEnabled = false;
        }

        public DbSet<CATEGORIA> CATEGORIAs { get; set; }
        public DbSet<CLIENTE> CLIENTEs { get; set; }
        public DbSet<COMPRA> COMPRAs { get; set; }
        public DbSet<CREDITO> CREDITOes { get; set; }
        public DbSet<DETALLE_CREDITO> DETALLE_CREDITO { get; set; }
        public DbSet<DETALLECOMPRA> DETALLECOMPRAs { get; set; }
        public DbSet<DETALLEPAGO> DETALLEPAGOes { get; set; }
        public DbSet<DETALLEVENTA> DETALLEVENTAs { get; set; }
        public DbSet<HISTORIAL_VENTAS> HISTORIAL_VENTAS { get; set; }
        public DbSet<IMPUESTO> IMPUESTOes { get; set; }
        public DbSet<PRODUCTO> PRODUCTOes { get; set; }
        public DbSet<PROVEEDOR> PROVEEDORs { get; set; }
        public DbSet<sysdiagram> sysdiagrams { get; set; }
        public DbSet<VENTA> VENTAs { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new CATEGORIAMap());
            modelBuilder.Configurations.Add(new CLIENTEMap());
            modelBuilder.Configurations.Add(new COMPRAMap());
            modelBuilder.Configurations.Add(new CREDITOMap());
            modelBuilder.Configurations.Add(new DETALLE_CREDITOMap());
            modelBuilder.Configurations.Add(new DETALLECOMPRAMap());
            modelBuilder.Configurations.Add(new DETALLEPAGOMap());
            modelBuilder.Configurations.Add(new DETALLEVENTAMap());
            modelBuilder.Configurations.Add(new HISTORIAL_VENTASMap());
            modelBuilder.Configurations.Add(new IMPUESTOMap());
            modelBuilder.Configurations.Add(new PRODUCTOMap());
            modelBuilder.Configurations.Add(new PROVEEDORMap());
            modelBuilder.Configurations.Add(new sysdiagramMap());
            modelBuilder.Configurations.Add(new VENTAMap());
        }
    }
}
